package com.hotel_management_backstage.lin.entity;

import com.hotel_management_backstage.lin.service.SysRoleService;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Component
public class SysUser implements Serializable{
    static final long serialVersionUID = 1L;

    private Integer id;

    private String name;

    private String password;

    @Autowired
    private SysRoleService sysRoleService;

    public String getRole(){
        SysRole sysRole = sysRoleService.selectById(id);
        return sysRole.getName();
    }
}
